package filesystem;
import java.util.Iterator;


public class DirectorySizeCalculator implements SizeCalculator {

	@Override
	public int CalculateSize(FSElement fse) 
	{		
		int result = 0;		
		Directory d = (Directory)fse;
		Iterator<FSElement> it = d.getChildren().iterator();
		while (it.hasNext())
		{
			result += it.next().getSize();
		}
		return result;
	}

}
